@echo off
echo Starting portal-site-server...

rem 设置Java环境变量
set JAVA_HOME=C:\Program Files\Java\jdk-20
set PATH=%JAVA_HOME%\bin;%PATH%

rem 设置Maven环境变量
set M2_HOME=D:\ruanjiankaifa\apache-maven-3.8.1
set PATH=%M2_HOME%\bin;%PATH%
set MAVEN_OPTS=-Dmaven.repo.local=D:\ruanjiankaifa\localRepository

rem 设置MySQL路径
set MYSQL_HOME=D:\ruanjiankaifa\MySQL\MySQL Server 8.0\bin
set PATH=%MYSQL_HOME%;%PATH%

echo Initializing database...
"%MYSQL_HOME%\mysql" -u root -pFqMySQL < init-db.sql

echo Starting Spring Boot application...
call mvn spring-boot:run

pause